#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ll time;
    cin >> time;
    time /= 1000;
    time %= 24 * 60 * 60;
    printf("%02d:%02d:%02d", time / 3600, time % 3600 / 60, time % 3600 % 60);
    return 0;
}